package com.ibm.java;

import java.io.File;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

/**
 * whether a file is xml or not
 * @author Jingjing Wang
 *2015-5-12
 */
public class XMLParser {
	public static void main(String[] args) {

		try {
			DocumentBuilderFactory foctory = DocumentBuilderFactory
					.newInstance();
			DocumentBuilder builder = foctory.newDocumentBuilder();
			builder.parse(new File("testcase/NewFile.xml"));
			System.out.println("is xml");
		} catch (Exception e) {
			System.out.println("not xml");
		}
	}
}
